package com.tcs.test.designmodel.proxy.cglib.proxy;

import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;

public class Factory<T> {

	@SuppressWarnings("unchecked")
	public T getInstance(MethodInterceptor methodInterceptor, T t) {
		Enhancer enhancer = new Enhancer();
		enhancer.setSuperclass(t.getClass());
		enhancer.setCallback(methodInterceptor);
		return (T) enhancer.create();
	}
}
